package com.zero.test2;

public class Test {
    public static void main(String[] args) {
        Animal dog = new Dog("小黑","2","黑");
        dog.eat();
        dog.drink();
        ((Dog) dog).lookHome();
        if (dog instanceof Dog d){
            d.lookHome();
        }

        Animal[] c = new Chick[3];
        c[0] = new Chick("花花","2","棕");
        c[1] = new Chick("叶叶","1","黑");
        c[2] = new Chick("扭扭","1.5","白");
        for (int i = 0; i < c.length; i++) {
            String name = c[i].getName();
            System.out.println(name);
            c[i].eat();
            ((Chick) c[i]) .layEggs();

        }


        Fish fish = new Fish("金金","3","金");
        fish.eat();
        fish.drink();




    }
}
